<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-'.CONFIG_SUFFIX.'.php'),
    require(__DIR__ . '/menu-'.CONFIG_SUFFIX.'.php') //菜单
);

return [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [
        'gridview' => [
            'class' => 'kartik\grid\Module',
        ],
        'markdown' => [
            'class' => 'kartik\markdown\Module',
        ]
    ],
    'defaultRoute' => 'index/index',
    'components' => [
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
//        'errorHandler' => [
//            'errorAction' => 'public/error',
//        ],
//        'db' => [
//            'enableSchemaCache' => true, //数据库结构缓存
//            'schemaCacheDuration' => 4, //数据库缓存时间
//        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '.html',
            'rules' => [
                '<controller:[\w-]+>/<id:\d+>/<action:[\w-]+>' => '<controller>/<action>',
                '<controller:[\w-]+>/<id:\d+>' => '<controller>/index',
                '<controller:[\w-]+>' => '<controller>/index',
            ],
        ],

        'formatter' => [
            'locale' => 'zh_CN',
            'dateFormat' => 'Y-M-d',
            'datetimeFormat' => 'Y-M-d HH:mm:ss',
            'decimalSeparator' => '.',
            'thousandSeparator' => ' ',
            'currencyCode' => '',
            'nullDisplay' => '',
        ],
    ],
    'params' => $params,
];
